package io.netty.example.study.common.auth;

import io.netty.example.study.common.Operation;
import io.netty.example.study.common.OperationResult;
import lombok.Data;
import lombok.extern.java.Log;

/**
 * AuthOperation -> Operation -> MessageBody
 */
@Data
@Log
public class AuthOperation extends Operation {
    private final String userName;
    private final String password;

    @Override
    public AuthOperationResult execute() {
        if ("admin".equalsIgnoreCase(this.userName)) {
            AuthOperationResult authResponse = new AuthOperationResult(true);
            return authResponse;
        }
        return new AuthOperationResult(false);
    }
}
